package com.vegetable.modules.controller.baseData;


import com.alibaba.fastjson.JSON;
import com.vegetable.common.utils.PageUtils;
import com.vegetable.common.utils.R;
import com.vegetable.modules.service.baseData.IBaseCommodityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 基础商品 前端控制器
 * </p>
 *
 * @author wangruijie
 * @since 2024-03-04
 */
@Slf4j
@RestController
@RequestMapping("/baseCommodity")
@AllArgsConstructor
@Api(value = "基础商品", tags = "基础商品")
public class BaseCommodityController {

    private IBaseCommodityService baseCommodityService;
    /**
     * 所有基础商品列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "产地商品新增时查询基础商品列表", notes = "产地商品新增时查询基础商品列表")
    public R list(@RequestParam Map<String, Object> params){
        log.info("条件查询基础商品列表{}", JSON.toJSONString(params));
        PageUtils page = baseCommodityService.queryPage(params);

        return R.data( page);
    }

}
